<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>daysAgo</title>
</head>

<body>
    <script>
        const daysAgo = n => {
            let d = new Date();
            d.setDate(d.getDate() - Math.abs(n));
            return d.toISOString().split('T')[0];
        };
        document.writeln(daysAgo(20))
    </script>
</body>

</html>